package com.wanmait.gohome.controller.manage;

import com.github.pagehelper.PageInfo;
import com.wanmait.gohome.pojo.Journal;
import com.wanmait.gohome.service.JournalService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;

@Controller
@RequestMapping("/manage")
public class LogController {
    @Resource
    JournalService journalService;
//后台用户日志管理
@RequestMapping("/show/log")
    public void log()
{

}

@RequestMapping("/ajaxJsp/logDetails")
public ModelAndView logDetails(Journal journal)
{
    Journal journal1  = journalService.findlogDetails(journal);
    ModelAndView mv = new ModelAndView();
    mv.addObject("journal1",journal1);
    return mv;
}
@RequestMapping("/ajaxJsp/findDaily")
    public ModelAndView findDaily()
{

    ModelAndView mv = new ModelAndView();
      PageInfo<Journal> pageInfo = journalService.findtotal();
      mv.addObject("pageInfo",pageInfo);
    return mv;

}
    @RequestMapping("/show/seal")
    @ResponseBody
    public void closure(Journal journal)
    {
        journalService.updateEnable(journal);
    }
    @RequestMapping("/ajaxJsp/findStopSeal")
    public ModelAndView findStopSeal()
    {
        ModelAndView mv = new ModelAndView();
         PageInfo<Journal> pageInfo = journalService.findStopSeal();
         mv.addObject("pageInfo",pageInfo);
        return  mv;
    }
  @RequestMapping("/show/remove")
  @ResponseBody
    public void remove(Integer id)
  {
      journalService.removeEssay(id);
  }
  @RequestMapping("/ajaxJsp/wordSearch")
    public ModelAndView wordSearch(String title)
  {

      PageInfo<Journal> pageInfo =  journalService.findTitlePageInfo(title);
      ModelAndView mv = new ModelAndView();
      mv.addObject("pageInfo",pageInfo);
      mv.addObject("title",title);
      return mv;
  }

}
